package com.sicheng.lc.周赛.分类.模拟;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/23 22:54
 */
public class 数组的三角和 {
    //https://leetcode.cn/problems/find-triangular-sum-of-an-array/
    public int triangularSum(int[] nums) {
        int n = nums.length;
        while (n != 1) {
            for (int i = 0; i < n; i++) {
                nums[i] = (nums[i] + nums[i + 1]) % 10;
            }
            n--;
        }
        return nums[0];
    }
}
